package cn.ecut.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * @Author ruanxin
 */
@Controller
public class RestfulController {

//    @RequestMapping("/add/{a}/{b}")
//    public String test01(@PathVariable int a ,@PathVariable  int b, Model model){
//        int res=a+b;
//        model.addAttribute("msg","res="+res);
//        return "hello";
//    }

//    @RequestMapping(value = "/helloo" ,method = {RequestMethod.GET})
    @GetMapping("/helloo/{a}/{b}")
    public String test02(@PathVariable int a ,@PathVariable  int b, Model model){
        int res=a+b;
        model.addAttribute("msg","gethelloooo"+res);
        return "hello";
    }


//    @RequestMapping(value = "/helloo" ,method = {RequestMethod.POST})
    @PostMapping("/helloo/{a}/{b}")
    public String test03(@PathVariable int a ,@PathVariable  int b, Model model){
        int res=a+b;
        model.addAttribute("msg","posthelloooo"+res);
        return "hello";
    }
}
